<?php

Yii::import('application.models._base.BaseFavorites');


class Favorites extends BaseFavorites
{
	public static function model($className=__CLASS__) {
		return parent::model($className);
	}
	
    public function search_my(){
		$criteria = new CDbCriteria;
		$criteria->order="t.created_time desc";
		$criteria->addCondition('customer_id='.yii::app()->user->id);
		$criteria->addCondition('enable=1');
		$criteria->join='JOIN auction_info ON t.auction_id=auction_info.id and auction_info.is_delete = 0';
		// var_dump($criteria);exit();
		//$phistory=EarnedBidLog::model()->findAll( 'customer_id=:customer_id  and bid_type = 1',array(':customer_id'=>Yii::app()->user->id));
		return  $a=new CActiveDataProvider($this, array(
			'criteria' => $criteria,
			'pagination'=>array(
				'pageSize'=>5, //当前页数显示记录条数
				),

		));
	}	
	public function relations() {
		return array(
				'AuctionInfo'=>array(self::BELONGS_TO, 'AuctionInfo', 'auction_id'),
		);
    }	
}